package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

public class DiseaseInfoMergeRequest extends Request{

	private static final long serialVersionUID = 961293974370759938L;

	private Integer id;
	private Integer userId;
	private String diseaseName;
	private String occurrenceTime;
	private String createTime;
	private String updateTime;
	private Integer status;
	
	@Override
	public void parse(HttpServletRequest request) {
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		this.id = requestInfo.getIntParameter(ApiUrlParamEnum.id.getParamName(), 0);
		this.userId = requestInfo.getIntParameter(ApiUrlParamEnum.userId.getParamName(), 0);
		this.diseaseName = requestInfo.getParameter(ApiUrlParamEnum.diseaseName.getParamName(), "");
		this.occurrenceTime = requestInfo.getParameter(ApiUrlParamEnum.diseaseOccurrenceTime.getParamName(), "");
		this.createTime = requestInfo.getParameter(ApiUrlParamEnum.createTime.getParamName(), "");
		this.updateTime = requestInfo.getParameter(ApiUrlParamEnum.updateTime.getParamName(), "");
		this.status = requestInfo.getIntParameter(ApiUrlParamEnum.status.getParamName(), -1);
		
		if(userId<1){
			throw new RequestIllegalException("error userId: " + userId);
		}
		if(status<0){
			throw new RequestIllegalException("error status: " + status);
		}
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public String getDiseaseName() {
		return diseaseName;
	}

	public void setDiseaseName(String diseaseName) {
		this.diseaseName = diseaseName;
	}

	public String getOccurrenceTime() {
		return occurrenceTime;
	}

	public void setOccurrenceTime(String occurrenceTime) {
		this.occurrenceTime = occurrenceTime;
	}

	public String getCreateTime() {
		return createTime;
	}

	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}

	public String getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(String updateTime) {
		this.updateTime = updateTime;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

}
